##
## Makefile for mysh in /home/nadali_t//local/svn/tek2ed/minishell1
## 
## Made by thomas nadalie
## Login   <nadali_t@epitech.net>
## 
## Started on  Thu Nov  8 12:23:30 2012 thomas nadalie
## Last update Thu Nov  8 12:24:34 2012 thomas nadalie
##

NAME=   mysh

SRC=   	shell/main.c \
	shell/my_str_to_wordtab.c \
	shell/my_path_to_wordtab.c \
	shell/basics.c \
	shell/exec.c \
	shell/make_path.c \
	shell/my_prompt.c \
	shell/env.c \
	shell/exit.c \
	shell/builtins.c \
	shell/exec_bin.c \
	shell/redir.c \
	shell/redir_right.c \
	xfunc/xwait.c \
	xfunc/xmalloc.c \
	xfunc/xopen.c \
	xfunc/xdup2.c \
	xfunc/xfork.c

OBJ=    $(SRC:.c=.o)

RM=     rm -f

CFLAGS= -g -Wall -Iinclude

LIB=	cd ./lib/

MAKE=	/usr/bin/make

LDFLAGS= -L. -lmy

all:    $(NAME)

$(NAME):       lib $(OBJ)
	cc -o $(NAME) $(OBJ) $(LDFLAGS)
lib:	
	$(LIB) && $(MAKE)

clean:
	$(RM) *~ $(RM) ./lib/*~ $(RM) ./shell/*~ $(RM) ./xfunc/*~
	$(RM) *.o $(RM) ./lib/*.o $(RM) ./shell/*.o $(RM) ./xfunc/*.o
	$(RM) *# $(RM) ./lib/*# $(RM) ./shell/*# $(RM) ./xfunc/*#

fclean: clean
	$(RM) $(NAME)

re:     fclean all

.PHONY:	all lib clean fclean re